Almost any device that is attached to the Internet requires some sort of time synchronization.
Today, this is typicaly accomplished using NTP.
NTP is a protocol which allows a client to request the proper time from a server and to
provide this time to other clients as well.
NTP based timing is a very important feature of the M8722NF system board system software.
Time syncronization is accompliced using two systems.
When the system boots, the onboard RTC is used to set the system time. If a NTP server is
defined, a UDP socket is opened and the UDP time is retreived.
After the initial time stamp is processed, the system is slowly synced to NTP using a PD
control loop.
When the time system achieves stability, the RTC clock is set to NTP time and the system
internal timer is the time standard.
The system is said to be in sync, with NTP, when the offset from NTP is less that 100ms.
When the system is allowed to settle, the offset from NTP is less than 10ms.
Although not currently implemented, it is possible to achieve less than 1ms timing with the
proper software tuning.
The user can get the proper time via the 32 bit unsigned integer: SYSSeconds.
The proper way to access the system timer is to use the GetSystemTimer() macro. Here is
an example:
DWORD Mytime;
GetSystemTimer(Mytime);
Variable "Mytime" now has the proper time.
The SYSSeconds variable provides the time in UTC seconds.
Normally, a user will need to use the lctime() and gmtime() functions to get the right time.
lctime() formats UTC time to local offset (including DST).
gmtime formats time to month, day, year, etc.